Class path

JDK tools use the class path concept to find source and byte-code files during compilation, execution and debugging etc. The same concept is used by the SNiFF+ Java parser.
SNiFF+ generates and sets this class path transparently for you, so that you do not have to worry about this when you work on several parallel projects. You can specify a different class path for each (sub)project. All the settings are therefore project-specific and can be set in the Project Attributes dialog.

- Note: The class path always ends one directory level higher than the highest-level directory containing named package code.

The following excerpts from the original JDK documentation illustrate the class path concept as it is used by the JDK tools. SNiFF+ uses this concept in exactly the way.

Synopsis [excerpt from original JDK documentation]
"The class path can be set using either the -classpath option with the a JDK tool (the preferred method) or by setting the CLASSPATH environment variable.
C:> jdkTool -classpath path1;path2...
C:> set CLASSPATH=path1;path2...
Each class path ends with a file name or directory depending on what you are setting the class path to:

- For a

.zip or .jar file that contains .class files, the path ends with the name of the .zip or .jar file.
- For
.class files in an unnamed package, the path ends with the directory that contains the .class files.
- For
.class files in a named package, the path ends with the directory that contains the "root" package (the first package in the full package name).
..."
(To restate the point, the class path always ends one directory level higher than the highest-level directory containing named package code.)
Example on class path and package names [excerpt from original JDK documentation]
"Java classes are organized into packages which are mapped to directories in the file system. But, unlike the file system, whenever you specify a package name, you specify the whole package name -- never part of it. For example, the package name for java.awt.Button is always specified as java.awt ."
For example, suppose you want the Java runtime to find a class named Cool.class in the package utility.myapp.
If the path to that directory is
C:\java\MyClasses\utility\myapp
you would set the class path so that it contains
C:\java\MyClasses
To run that app, you could use the following JVM command:
C:> java -classpath C:\java\MyClasses utility.myapp.Cool
When the app runs, the JVM uses the class path settings to find any other classes defined in the utility.myapp package that are used by the Cool class.
Note that the entire package name is specified in the command. It is not possible, for example, to set the class path so it contains C:\java\MyClasses\utility and use the command, java myapp.Cool. The class would not be found."

- The above excerpts illustrate the class path/package concepts as used by the JDK tools. SNiFF+ uses these concepts in exactly the same way.

Troubleshooting
Bugs in the class path as used by SNiFF+ can be difficult to identify. The relevant information about what SNiFF+ generates is in the following file
ProjectDirectory/.sniffdir/macros.incl
(search for SNIFF_JAVA_CLASSPATH )